<include file="Index/header"/>
<script language="javascript" type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>

<style>
    .teacher {
        margin-left: 20px;
        border: solid 1px #ccc;

    }

    .teacher td {
        height: 50px;
        margin-left: 20px;
        width: 500px;
        border: solid 1px #ccc;
        line-height: 50px;
    }

    .teacher select {

        margin-left: 20px;
    }

    .teacher input {

        margin-left: 20px;

    }

    .input-xlarge {
        width: 500px;
        height: 100px;

    }
</style>
<include file="Index/left"/>


<div class="content">

    <div class="header">

        <h1 class="page-title">录入班次资料</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="{:U('Index/Index')}">首页</a> <span class="divider">/</span></li>
        <li><a href="#">课程安排</a> <span class="divider">/</span></li>
        <li class="active">班次信息管理</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">


            <div class="well" id='well2'>
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#home" data-toggle="tab">添加班次信息</a></li>

                </ul>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form id="tab">
                            <table width="800px" border="0" class="teacher">
                                <tr>
                                    <td colspan="2"> 班次编号
                                        <input type="text" name="scheid" class="input-xlarge" value='' id="scheid"
                                               maxlength="9"><span class="alert alert-danger"
                                                                   style="width:100px; display:none" id="error"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2"> 主办单位
                                        <input type="text" name="zbdw" class="input-xlarge" value='' id="scheid"><span
                                                class="alert alert-danger" style="width:100px; display:none"
                                                id="error"></span></td>
                                </tr>

                                <tr>
                                    <td colspan="2"> 班次名称
                                        <input type="text" value="" name="schename" class="input-xlarge"></td>
                                </tr>
                                <tr>
                                    <td colspan="2">班次类型
                                        <select name="classlb" id="classlb">
                                            <volist name="dqlist" id="vb">
                                                <option value="{$vb.dict_name}">{$vb.dict_name}</option>
                                            </volist>
                                        </select></td>
                                </tr>
                                <tr>
                                    <td>接班老师
                                        <select name="jteacher" id="jteacher">
                                            <volist name="telist" id="vc">
                                                <option value="{$vc.tname}">{$vc.tname}</option>
                                            </volist>
                                        </select></td>
                                    <td> 带班老师
                                        <select name="dteacher" id="dteacher">
                                            <volist name="telist" id="vd">
                                                <option value="{$vd.tname}">{$vd.tname}</option>
                                            </volist>
                                        </select></td>
                                </tr>
                                <tr>
                                    <td colspan="2"> 备&nbsp;&nbsp;&nbsp;&nbsp;注&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <textarea name="remark" cols="50" rows="6" id="remark"
                                                  class="input-xlarge"></textarea></td>
                                </tr>
                                <!-- <tr><td colspan="2">   备&nbsp;&nbsp;&nbsp;&nbsp;注2&nbsp;&nbsp;&nbsp;&nbsp;
                                         <textarea cols="50" rows="6" name="crc" class="input-xlarge"></textarea></td></tr>--></table>
                            <br/>
                            <div style="margin-left:280px;">
                                <button type="button" class="btn btn-primary" onclick="tj()">
                                    确&nbsp;&nbsp;&nbsp;&nbsp;定
                                </button>&nbsp;&nbsp;&nbsp;&nbsp;
                                <button type="button" class="btn btn-primary" onclick="history.go(-1)">取&nbsp;&nbsp;&nbsp;&nbsp;消</button>
                            </div>
                        </form>
                    </div>

                </div>
            </div>

        </div>


        <footer>
            <hr>


        </footer>

    </div>
</div>

<script type="text/javascript">
    function tj() {
        var bcbh = $('#scheid').val();
        var remark = $('#remark').val().length;
        if (remark > 100) {

            alert('备注超过最大字数限制');
            return
        }
        if (bcbh === '') {
            alert('班次编号不能为空');
            $('#error').show();
            $('#error').text('班次编号不能为空');
            exit();
        }
        $.ajax({
            type: "POST",
            url: "__CONTROLLER__/AddClasses",

            cache: false,
            data: $('#tab').serialize(),

            success: function (data) {
                switch (data) {

                    case '0':
                        if (confirm("是否继续添加课程信息")) {
                            location.href = "__CONTROLLER__/Addcurr/bh/" + bcbh + "";
                        } else {
                            window.location.replace("__CONTROLLER__/Classes");
                        }

                        break;
                    case '1':
                        alert('添加失败');

                        break;
                    case '3':
                        alert('班次编号已存在');
                        $('#error').show();
                        $('#error').text('班次编号已存在');
                        break;
                    default:
                        alert(data);
                }

            }


        })


    }
</script>

<script src="__PUBLIC__/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function () {
        $('.demo-cancel-click').click(function () {
            return false;
        });
    });
</script>

</body>
</html>


